﻿namespace Digitalmes.Domain.Mes;

/// <summary>
/// 物料有效期数据。
/// </summary>
/// <remarks>设置具体物料的有效期，在扫码校验时会进行比对</remarks>
[SugarTable("md_item_expiry", "物料有效期数据表")]
public class MdItemExpiry : EntityBase
{
    /// <summary>
    /// 物料 Id
    /// </summary>
    [SugarColumn(ColumnDescription = "物料Id")]
    public long MdItemId { get; set; }

    /// <summary>
    /// 物料
    /// </summary>
    [NotNull]
    [Navigate(NavigateType.OneToOne, nameof(MdItemId))]
    public MdItem? Item { get; set; }

    /// <summary>
    /// 物料条码
    /// </summary>
    [NotNull]
    [SugarColumn(ColumnDescription = "物料条码", Length = 64)]
    public string? Barcode { get; set; }

    /// <summary>
    /// 有效期（天）
    /// </summary>
    [SugarColumn(ColumnDescription = "有效期(天)")]
    public int Durability { get; set; }

    /// <summary>
    /// 有效期截止日期，包含当天。
    /// </summary>
    [SugarColumn(ColumnDescription = "有效期截止日期")]
    public DateTime ExpireDate  { get; set; }
}
